<?php

use think\migration\Seeder;

class BasicFacilityData extends Seeder
{
    /**
     * 设施
     * 一个公司company有多个排口drain
     * 一个排口drain有多个设施facility
     * 一个设施facility有多个设备device，目前不说设备，只说设施，所以device数据暂时为空
     */
    public function run()
    {
        $table = $this->table('basic_facility');
        $rows  = [
            //1机组的信息
            [
                //step1:基本信息
                'number'      => '1',
                'name'        => 'TX-1A1',
                'name_cn'        => '机组1脱硝1',
                'description' => '脱硝1，TX-1A1简称，1机组，锅炉A，脱硝设施1',

                //step2：关联ID
                'boiler_id'   => '1',
                'machine_id'  => '1',
                'company_id'  => '1',
                'drain_id'    => '1',
                'type'        => '1', //1脱硫2脱硝
            ],
            [
                //step1:基本信息
                'number'      => '2',
                'name'        => 'TX-1A2',
                'name_cn'        => '机组1脱硝2',
                'description' => '脱硝2，TX-1A2简称，1机组，锅炉A，脱硝设施2',

                //step2：关联ID
                'boiler_id'   => '1',
                'machine_id'  => '1',
                'company_id'  => '1',
                'drain_id'    => '1',
                'type'        => '1', //1脱硫2脱硝
            ],
            [
                //step1:基本信息
                'number'      => '1',
                'name'        => 'TS-1A',
                'name_cn'        => '机组1脱硫',
                'description' => '脱硫，TL-1A简称，1机组，锅炉A，脱硫设施',

                //step2：关联ID
                'boiler_id'   => '1',
                'machine_id'  => '1',
                'company_id'  => '1',
                'drain_id'    => '1',
                'type'        => '2', //1脱硫2脱硝
            ],

            //2机组的信息
            [
                //step1:基本信息
                'number'      => '1',
                'name'        => 'TX-2A1',
                'name_cn'        => '机组2脱硝1',
                'description' => '脱硝1，TX-2A1简称，2机组，锅炉A，脱硝设施1',

                //step2：关联ID
                'boiler_id'   => '2',
                'machine_id'  => '1',
                'company_id'  => '1',
                'drain_id'    => '1',
                'type'        => '1', //1脱硫2脱硝
            ],
            [
                //step1:基本信息
                'number'      => '2',
                'name'        => 'TX-2A2',
                'name_cn'        => '机组2脱硝2',
                'description' => '脱硝2，TX-2A2简称，2机组，锅炉A，脱硝设施2',

                //step2：关联ID
                'boiler_id'   => '2',
                'machine_id'  => '1',
                'company_id'  => '1',
                'drain_id'    => '1',
                'type'        => '1', //1脱硫2脱硝
            ],
            [
                //step1:基本信息
                'number'      => '1',
                'name'        => 'TS-2A',
                'name_cn'        => '机组2脱硫',
                'description' => '脱硫，TL-1A简称，2机组，锅炉A，脱硫设施',

                //step2：关联ID
                'boiler_id'   => '2',
                'machine_id'  => '1',
                'company_id'  => '1',
                'drain_id'    => '1',
                'type'        => '2', //1脱硫2脱硝
            ],

        ];
        $table->insert($rows)->save();
    }
}